<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div>
            <ul v-for="item in list">
                <li>{{item.name}}</li>
            </ul>
        </div>
        <!-- reverse -->
        <button @click="add">走一走</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                list: [{
                        id: 1,
                        name: '美女'
                    },
                    {
                        id: 2,
                        name: '帅哥'
                    },
                    {
                        id: 3,
                        name: '程序猿'
                    },
                ]
            },
            methods: {
                add() {
                    const firstItem = this.list.shift(); //shift 删除并返回数组的第一个元素
                    console.log(firstItem);

                    this.list.push(firstItem); // push将删除的元素添加到数组的末尾
                }
            }
        });
    </script>
</body>

</html>